package com.winner.kafka.controller;

import com.winner.kafka.model.UserLog;
import com.winner.kafka.producer.UserLogProducer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class UserLogController {

    @Autowired
    private UserLogProducer kafkaSender;

    @PostMapping("/sendMessage")
    public void sendMessage() {
        UserLog userLog = new UserLog();
        userLog.setUsername("Sino").setUserid("007").setState("0");
        kafkaSender.sendLog(userLog);
    }
}
